﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPages/Maintenance.Master" CodeBehind="Maps.aspx.vb" Inherits="Trebuchet.Maps" %>
<%@ MasterType  virtualPath="~/MasterPages/Maintenance.Master"%>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">


<style type="text/css">

.modalbackground
{
    background-color:Gray;
    opacity: 0.5;
    filter:Alpha(opacity=50);
}
 
.modalpopup
{
    background-color:White;
    padding:6px 6px 6px 6px;
}

 .hasPlaceholder {
	color: #777;
}

</style>

<script type="text/javascript">

    $(function () {

        //Check placeholder compatibility
        $.support.placeholder = false;
        test = document.createElement('input');
        if ('placeholder' in test) $.support.placeholder = true;

        //Set placeholder text in browsers that do not support it
        if (!$.support.placeholder) {
            var active = document.activeElement;
            $(':text').focus(function () {
                if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
                    $(this).val('').removeClass('hasPlaceholder');
                }
            }).blur(function () {
                if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
                    $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
                }
            });
            $(':text').blur();
            $(active).focus();
            $('form').submit(function () {
                $(this).find('.hasPlaceholder').each(function () { $(this).val(''); });
            });
        }

        //Setup Tabs
        $("#ModalTerritoryTabs").tabs();
        $("#ModalGroupTabs").tabs();

    });

   	</script>


</asp:Content>



<asp:Content ID="Content2" ContentPlaceHolderID="cphButtonBar" runat="server">
    <asp:Button ID="cmdSave" runat="server" Text="Save" />
    <asp:Button ID="cmdCancel" runat="server" Text="Cancel" />
    <asp:Button ID="cmdDelete" runat="server" Text="Delete" onclientclick="return confirm('Are you sure you want to delete? This is permanent, and cannot be reversed');"/>
    <asp:Button ID="cmdExit" runat="server" Text="Exit" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="cphContent" runat="server">

<section class="Controls" id="FormControls" runat="server">
    <div class="row">
        <div class="label">
            <asp:Label ID="lblName" runat="server">Name: </asp:Label>
        </div>
        <div class="field">
            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        </div>
        </div>
    <div class="row">
        <div class="label">
            <asp:Label ID="lblDescription" runat="server">Description: </asp:Label>
        </div>
        <div class="field">
            <asp:TextBox ID="txtDescription" runat="server" Rows="10"></asp:TextBox>
        </div>
    </div>
    <div class="row">
        <div class="label">
            <asp:Label ID="lblFileName" runat="server">File Name: </asp:Label>
        </div>
        <div class="field">
            <asp:TextBox ID="txtFileName" runat="server"></asp:TextBox>
        </div>
    </div>
    <div class="row">
        <div class="label">
            <asp:Label ID="lblMaxUsers" runat="server">Suggested Max Users: </asp:Label>
        </div>
        <div class="field">
            <asp:DropDownList ID="cboMaxUsers" runat="server"></asp:DropDownList>
        </div>
    </div>
    <div class="row">
        <div class="label">
            <asp:Label ID="lblBonusDivider" runat="server">Bonus Divider: </asp:Label>
        </div>
        <div class="field">
            <asp:TextBox ID="txtBonusDivider" runat="server"></asp:TextBox>
        </div>
    </div>
</section>


<section class="Grid">
<asp:ListView ID="lvMaps" runat="server">

    <LayoutTemplate>
        <table class="Data">
            <tr>
                <th></th>
                <th>Name</th>
                <th>Description</th>
                <th>File Name</th>
                <th>Suggested Max Users</th>
                <th>Bonus Divider</th>
            </tr>
            <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
        </table>
    </LayoutTemplate>

    <ItemTemplate>
        <tr>
            <td><asp:ImageButton ID="cmdEdit" runat="server" Text="Edit" CommandName="EditRecord" ImageUrl="~/images/icons/edit.png" /></td>
            <td><asp:literal ID="litName" runat="server"></asp:literal></td>
            <td><asp:literal ID="litDesc" runat="server"></asp:literal></td>
            <td><asp:literal ID="litFileName" runat="server"></asp:literal></td>
            <td><asp:literal ID="litMaxUsers" runat="server"></asp:literal></td>
            <td><asp:literal ID="litBonusDivider" runat="server"></asp:literal></td>
        </tr>
    </ItemTemplate>

    <EmptyDataTemplate>
        No records to Display
    </EmptyDataTemplate>

</asp:ListView>
</section>

<section class="ChildData">

    <fieldset id="fsTerritories" runat="server">
    <legend>Territories</legend>
        <div id="divTerritoryAddControls" runat="server" class="row">
            
            <asp:TextBox ID="txtSVGID" runat="server" Rows="5" Placeholder="SVG ID"></asp:TextBox>
            <asp:TextBox ID="txtTerritoryName" runat="server" Rows="10" Placeholder="Name"></asp:TextBox>
            <asp:TextBox ID="txtMaxUnits" runat="server" Rows="5" Placeholder="Max Units"></asp:TextBox>
            <asp:ImageButton ID="cmdAddTerritory" runat="server" ImageUrl="~/images/icons/add.png" />
           
        </div>
        <br />
        <asp:ListView ID="lvTerritories" runat="server">

        <LayoutTemplate>
            <table class="Data">
                <tr>
                    <th></th>
                    <th>SVG ID</th>
                    <th>Name</th>
                    <th>Max Units</th>
                </tr>
                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
            </table>
        </LayoutTemplate>

        <ItemTemplate>
            <tr>
                <td>
                    <asp:ImageButton ID="cmdEdit" runat="server" CommandName="EditRecord" ImageUrl="~/images/icons/edit.png" />
                    <asp:ImageButton ID="cmdDelete" runat="server" CommandName="DeleteRecord" ImageUrl="~/images/icons/delete.png" />
                </td>
                <td><asp:literal ID="litSVGID" runat="server"></asp:literal></td>
                <td><asp:literal ID="litName" runat="server"></asp:literal></td>
                <td><asp:literal ID="litMaxUnits" runat="server"></asp:literal></td>
            </tr>
        </ItemTemplate>

        <EmptyDataTemplate>
            <tr><td colspan="4">No records to Display</td></tr>
        </EmptyDataTemplate>

    </asp:ListView>
    </fieldset>

</section>

<section class="ChildData">

    <fieldset id="fsMapGroups" runat="server">
    <legend>Groups</legend>
        <div id="divMapGroupAddControls" runat="server" class="row">
            
            <asp:TextBox ID="txtMapGroupName" runat="server" Rows="5" Placeholder="Name"></asp:TextBox>
            <asp:TextBox ID="txtMapGroupBonus" runat="server" Rows="5" Placeholder="Unit Bonus"></asp:TextBox>
            <asp:ImageButton ID="cmdAddMapGroup" runat="server" ImageUrl="~/images/icons/add.png" />
           
        </div>
        <br />
        <asp:ListView ID="lvMapGroups" runat="server">

        <LayoutTemplate>
            <table class="Data">
                <tr>
                    <th></th>
                    <th>Name</th>
                    <th>Unit Bonus</th>
                </tr>
                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
            </table>
        </LayoutTemplate>

        <ItemTemplate>
            <tr>
                <td>
                    <asp:ImageButton ID="cmdEdit" runat="server" CommandName="EditRecord" ImageUrl="~/images/icons/edit.png" />
                    <asp:ImageButton ID="cmdDelete" runat="server" CommandName="DeleteRecord" ImageUrl="~/images/icons/delete.png" />
                </td>
                <td><asp:literal ID="litName" runat="server"></asp:literal></td>
                <td><asp:literal ID="litUnitBonus" runat="server"></asp:literal></td>
            </tr>
        </ItemTemplate>

        <EmptyDataTemplate>
            <tr><td colspan="4">No records to Display</td></tr>
        </EmptyDataTemplate>

    </asp:ListView>
    </fieldset>

</section>

<asp:Button ID="cmdTerritoryEditPopup" runat="server" style="display:none;" />
<ajax:ModalPopupExtender 
    ID="mpeTerritoryEdit" 
    runat="server" 
    TargetControlID="cmdTerritoryEditPopup" 
    PopupControlID="divTerritoryEdit"
    CancelControlID="cmdModalTerritoryCancel"
    BackgroundCssClass="modalbackground"
    y="10"
    x="30">
</ajax:ModalPopupExtender>

 <div id="divTerritoryEdit" runat="server" style="display:none;" class="modalpopup">
 
     <div id="ModalTerritoryTabs">
	    <ul>
		    <li><a href="#tabDetail">Details</a></li>
		    <li><a href="#tabAttackingTerritories">Attacking Territories</a></li>
	    </ul>
	    <div id="tabDetail">
 		    <asp:Label ID="lblModalSVGID" runat="server">SVG ID: </asp:Label>
            <asp:TextBox ID="txtModalSVGID" runat="server"></asp:TextBox>
            <br />
            <asp:Label ID="lblModalTerritoryName" runat="server">Name: </asp:Label>
            <asp:TextBox ID="txtModalTerritoryName" runat="server"></asp:TextBox>
            <br />
            <asp:Label ID="lblModalMaxUnits" runat="server">Max Units: </asp:Label>
            <asp:TextBox ID="txtModalMaxUnits" runat="server"></asp:TextBox>
            <br />
            <asp:Button ID="cmdModalTerritorySave" runat="server" Text="Save" />
            <asp:Button ID="cmdModalTerritoryCancel" runat="server" Text="Cancel" />
	    </div>
	    <div id="tabAttackingTerritories">
        <asp:UpdatePanel id="upAttackingTerritories" runat="server" UpdateMode="Conditional"><ContentTemplate>
		    <table>
                 <tr>
                    <td id="tdlblSelectedTerritories" runat="server" class="ControlMultiLine" nowrap="nowrap"></td>
                    <td></td>
                    <td id="tdlblAvailableTerritories" runat="server" class="ControlMultiLine" nowrap="nowrap"></td>
                 </tr>
                <tr>
                <td>
                    <asp:Label id="lblSelectedTerritories" runat="server" Font-Bold="true" name="lblSelectedTerritories">Can Attack</asp:Label>
                    <br />
                    <asp:ListBox ID="lstSelectedTerritories" runat="server" style="min-width:250px" Rows="15" EnableViewState="true" SelectionMode="Multiple" ></asp:ListBox>
                </td>
                <td align="center" >
                <asp:Button id="cmdTerritoryIn" Text="<" runat="server"/>
                <asp:Button id="cmdTerritoryOut" Text=">" runat="server"/><br />
                <asp:Button id="cmdAllTerritoryIn" Text="<<" runat="server"/>
                <asp:Button id="cmdAllTerritoryOut" Text=">>" runat="server"/>
                </td>
                <td>
                    <asp:Label id="lblAvailableTerritories" runat="server" Font-Bold="true" name="lblAvailableTerritories">Cannot Attack</asp:Label>
                    <br />
                    <asp:ListBox ID="lstAvailableTerritories" runat="server" style="min-width:250px" Rows="15" EnableViewState="true" SelectionMode="Multiple" ></asp:ListBox>
                </td>
                </tr>
            </table>
            </ContentTemplate></asp:UpdatePanel>
	    </div>

    </div>  
    
</div>

<asp:Button ID="cmdMapGroupEditPopup" runat="server" style="display:none;" />
<ajax:ModalPopupExtender 
    ID="mpeMapGroup" 
    runat="server" 
    TargetControlID="cmdMapGroupEditPopup" 
    PopupControlID="divMapGroupEdit"
    CancelControlID="cmdModalMapGroupCancel"
    BackgroundCssClass="modalbackground"
    y="10"
    x="30">
</ajax:ModalPopupExtender>

 <div id="divMapGroupEdit" runat="server" style="display:none;" class="modalpopup">
 
     <div id="ModalGroupTabs">
	    <ul>
		    <li><a href="#tabMapGroupDetail">Details</a></li>
		    <li><a href="#tabGroupTerritories">Group Territories</a></li>
	    </ul>
	    <div id="tabMapGroupDetail">
 		    <asp:Label ID="lblModalMapGroupName" runat="server">Name: </asp:Label>
            <asp:TextBox ID="txtModalMapGroupName" runat="server"></asp:TextBox>
            <br />
            <asp:Label ID="lblModalMapGroupBonus" runat="server">Bonus Units: </asp:Label>
            <asp:TextBox ID="txtModalMapGroupBonus" runat="server"></asp:TextBox>
            <br />
            <asp:Button ID="cmdModalMapGroupSave" runat="server" Text="Save" />
            <asp:Button ID="cmdModalMapGroupCancel" runat="server" Text="Cancel" />
	    </div>
	    <div id="tabGroupTerritories">
        <asp:UpdatePanel id="upGroupTerritories" runat="server" UpdateMode="Conditional"><ContentTemplate>
		    <table>
                 <tr>
                    <td id="tdSelectedGroupTerritories" runat="server" class="ControlMultiLine" nowrap="nowrap"></td>
                    <td></td>
                    <td id="tdAvailableGroupTerritories" runat="server" class="ControlMultiLine" nowrap="nowrap"></td>
                 </tr>
                <tr>
                <td>
                    <asp:Label id="lblSelectedGroupTerritories" runat="server" Font-Bold="true" name="lblSelectedGroupTerritories">Selected</asp:Label>
                    <br />
                    <asp:ListBox ID="lstSelectedGroupTerritories" runat="server" style="min-width:250px" Rows="15" EnableViewState="true" SelectionMode="Multiple" ></asp:ListBox>
                </td>
                <td align="center" >
                <asp:Button id="cmdMapGroupIn" Text="<" runat="server"/>
                <asp:Button id="cmdMapGroupOut" Text=">" runat="server"/><br />
                <asp:Button id="cmdAllMapGroupIn" Text="<<" runat="server"/>
                <asp:Button id="cmdAllMapGroupOut" Text=">>" runat="server"/>
                </td>
                <td>
                    <asp:Label id="lblAvailableGroupTerritories" runat="server" Font-Bold="true" name="lblAvailableGroupTerritories">Available</asp:Label>
                    <br />
                    <asp:ListBox ID="lstAvailableGroupTerritories" runat="server" style="min-width:250px" Rows="15" EnableViewState="true" SelectionMode="Multiple" ></asp:ListBox>
                </td>
                </tr>
            </table>
            </ContentTemplate></asp:UpdatePanel>
	    </div>

    </div>  
    
</div>

</asp:Content>

 